package com.whenjun.util;

/**
 * @author whenjun
 *
 */
public class TransUtil {

    /**
     * 将秒数转换为分钟和秒
     * @param seconds
     * @return
     */
    public static String convertSecondsToMinutes(int seconds) {
        int minutes = seconds / 60;  // 分钟部分
        int remainingSeconds = seconds % 60;  // 剩余的秒数
        return minutes + "分" + remainingSeconds + "秒";
    }


    public static String convertSecondsToTime(Integer seconds) {
        if (seconds == null) {
            return "";
        }
        int hours = seconds / 3600;          // 小时部分
        int minutes = (seconds % 3600) / 60; // 分钟部分
        int remainingSeconds = seconds % 60; // 剩余的秒数
        return (hours == 0 ? "" : hours + "小时") + minutes + "分" + remainingSeconds + "秒";
    }

    public static void main(String[] args) {
        System.out.println(convertSecondsToMinutes(121));
    }
}
